package com.ai.pos.client.module;

import java.util.ArrayList;

import com.ai.pos.client.module.interfaces.IModule;
import com.ai.pos.client.module.interfaces.ModuleTemplate;
import com.ai.pos.client.user.Preferences;
import com.extjs.gxt.desktop.client.Shortcut;
import com.extjs.gxt.ui.client.event.ComponentEvent;
import com.extjs.gxt.ui.client.event.SelectionListener;
import com.extjs.gxt.ui.client.widget.Composite;
import com.extjs.gxt.ui.client.widget.Window;
import com.google.gwt.event.shared.EventBus;

public class Sales extends ModuleTemplate implements IModule{

	
	Composite NewSalesItem;
	Window SalesItemList;
	Window NewSalesCategory;
	Window SalesCategoryList;
	Window NewReportGroup;
	Window ReportGroupList;
	
	Shortcut SalesItems;
	Shortcut SalesCategory;
	Shortcut ReportGroups;
	
	public Sales()
	{
		SalesItems = new Shortcut();
		SalesCategory = new Shortcut();
		ReportGroups = new Shortcut();
		
		setShortcutHandlers();
	}
	
	
	private void setShortcutHandlers()
	{
		SalesItems.addSelectionListener(new SelectionListener<ComponentEvent>(){

			@Override
			public void componentSelected(ComponentEvent ce) {
				
				SalesItemList.show();
			}
			
		});	
		
		SalesCategory.addSelectionListener(new SelectionListener<ComponentEvent>(){

			@Override
			public void componentSelected(ComponentEvent ce) {
				// TODO Auto-generated method stub
				
			}
			
		});	
		
		ReportGroups.addSelectionListener(new SelectionListener<ComponentEvent>(){

			@Override
			public void componentSelected(ComponentEvent ce) {
				// TODO Auto-generated method stub
				
			}
			
		});	
		
	}
	
	
	@Override
	public void SaveCurrentStateToServer() {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void SaveCurrentStateToClient() {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void InvalidateClientCache() {
		// TODO Auto-generated method stub
		
	}

	@Override
	public ArrayList<Window> ProvideUis() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public ArrayList<Shortcut> ProvideShortCuts() {
		
		ArrayList<Shortcut> shortcuts = new ArrayList<Shortcut>();
		shortcuts.add(SalesItems);
		shortcuts.add(SalesCategory);
		shortcuts.add(ReportGroups);
		
		
		return shortcuts;
	}


	@Override
	public void ApplyUserPreferences(Preferences pref) {
		// TODO Auto-generated method stub
		
	}


	@Override
	public void LoadStateFromCache() {
		// TODO Auto-generated method stub
		
	}


	@Override
	public void RegisterListenersToEventBus(EventBus eventBus) {
		//TODO: Research how to do this.
		
	}

	
	
	
	
	
}
